<style>
.label {
	font-size:0.7rem;
}
</style>
<div class='fui-page fui-page-current' ng-if="pagedata.op=='main'">
	<div class="fui-header">
			<div class="fui-header-left" onclick="window.history.go(-1);">
				<a class="back"></a>
			</div>
			<div class="title">发布任务</div>
			<div class="fui-header-right"></div>
	</div>
	<div class="fui-content">
	<!-- 关注按钮 -->
	<div class="fe-guide" ng-if="pagedata.pluginset.isfollow==1 && (pagedata.isfollow==0 || !pagedata.isfollow)" style="display:block;z-index:890;">
		<div class="fe-guide-faceimg"><img ng-src="{{tomedia(pagedata.pluginset.logo) || '../core/resource/images/nopic.jpg'}}" /></div>
		<div class="fe-guide-sub" onclick="$('#followbar').modal();">立即关注</div>
		<div class="fe-guide-text">
			<p class="">{{pagedata.pluginset.followtitle ||'加关注,更多权限！'}}</br>{{pagedata.pluginset.followdesc ||'关注公众号，享专属服务'}}</p>
		</div>
	</div>
	<div id="followbar" class="modal fade" tabindex="-1" style="z-index:99999;display:none;position: absolute">
		<div class="modal-dialog" style="width:60%;left:20%">
			<div class="wap-qrcode-container">
				<p class="example1">{{pagedata.pluginset.title || '欢迎浏览'}}</p>
					<div class="wap-qrcode-image">
						<img ng-src="{{tomedia(pagedata.pluginset.ewm) || '../core/resource/images/nopic.jpg'}}"/>
					</div>
				<p class="example1">长按二维码关注</p>
				</div>
		</div>
	</div>
	<div class="weui_cells">
			<div class="weui_cell">
				<div class="weui_cell_hd"><label class="weui_label">选择类型</label></div>
			</div>
			<div class="weui_cell">
				<div class="weui_cell_bd" style="line-height:2">
					<span ng-repeat="(k,v) in pagedata.renwu_types" ng-click="pagedata.post.type=k" ng-class="{'label label-default':1,'active':pagedata.post.type==k}" style="margin-right:0.5rem;">{{v}}</span>
				</div>
			</div>
	</div>
	<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">标题</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-model="pagedata.post.title" value="{{pagedata.post.title}}" placeholder="关键要点，10个字内">
					</div>
				</div>
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">任务说明</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-model="pagedata.post.desc" value="{{pagedata.post.desc}}" placeholder="任务备注">
					</div>
				</div>
				<div class="weui_cell" ng-if="pagedata.post.type == 0">
					<div class="weui_cell_hd"><label class="weui_label">广告图片</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<ul class="weui_uploader_files" ng-if="pagedata.post.ad_image">
							  <li class="weui_uploader_file" style="background-image:url({{tomedia(pagedata.post.ad_image)}})"></li>
						</ul>
						<div class="weui_uploader_input_wrp">
							 <input class="weui_uploader_input" ng-model="pagedata.post.ad_image" ng-click="up_file(pagedata.post,'ad_image','image')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
						</div>
					</div>
				</div>
				<div ng-if="pagedata.post.type==1" class="weui_cells_title">广告视频</div>
				<div ng-if="pagedata.post.type==1" class="weui_cells weui_cells_form">
								<div class="weui_cell">
										<div class="weui_cell_bd weui_cell_primary" style="">
											<ul class="weui_uploader_files" ng-if="pagedata.post.ad_video">
												  <li class="weui_uploader_file" style="width: 108px;height: 60px;background: #333;">
													<video ng-src="{{tomedia(pagedata.post.ad_video)}}" poster="{{tomedia(pagedata.post.thumb)}}" height="60" width="100%"  x5-playsinline="" playsinline="" webkit-playsinline="" poster="" preload="auto"></video>
												  </li>
											</ul>
											<div class="weui_uploader_input_wrp">
												 <input class="weui_uploader_input" ng-click="choose_source(pagedata.post,['ad_video','thumb'],'video')"  multiple="">
											</div>
										</div>
								</div>
				</div>
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">限时</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<select ng-model="pagedata.post.hours_type" class="form-control tpl-province">
						<option value="" selected="selected">选择任务限时</option>
						<option ng-repeat="(key,value) in pagedata.hours_type" value="{{key}}" ng-selected="pagedata.post.hours_type==key;" >{{value}}</option>
						</select>
					</div>
				</div>
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">审核</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<select ng-model="pagedata.post.shenhedays" class="form-control tpl-province">
						<option value="" selected="selected">选择审核时间</option>
						<option ng-repeat="(key,value) in pagedata.shenhedays" value="{{key}}" ng-selected="pagedata.post.shenhedays==key;" >{{value}}</option>
						</select>
					</div>
				</div>
				<div class="weui_cell weui_cells_radio">
					<div class="weui_cell_hd"><label class="weui_label">做单次数</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<div ng-repeat="(k,v) in pagedata.times_type" ng-click="pagedata.post.times_type=k" class="fui-cell-label" style="margin-right:0.5rem;float:left;">
							<input type="radio" ng-checked="pagedata.post.times_type==k" class="fui fui-radio fui-radio-danger verify-radio" style="margin-right:0.2rem" name="radio2" value="{{k}}"> {{v}}
						</div>
					</div>
				</div>
		</div>
		<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">任务单价</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-change="pagedata.upyufee()" ng-model="pagedata.post.fee" value="{{pagedata.post.fee}}" placeholder="最低出价0.1元">
					</div>
				</div>
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">任务数量</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						<input class="weui_input" type="text" ng-change="pagedata.upyufee()" ng-model="pagedata.post.totalnum" value="{{pagedata.post.totalnum}}" placeholder="最少5单">
					</div>
				</div>
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">预计费用</label></div>
					<div class="weui_cell_bd weui_cell_primary">
						{{pagedata.post.yufee}}
					</div>
				</div>
				
		</div>
		<div class="weui_cells weui_cells_form">
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">做单步骤</label></div>
					<div class="weui_cell_bd weui_cell_primary red">
						(建议网址和二维码放在第一步)
					</div>
				</div>
				
				<div ng-repeat="p in pagedata.post.steps">
					<div class="weui_cells_title"><span class="red bold">{{$index+1}}</span>、{{p.title}}</div>
					<div class="weui_cell">
						<div ng-if="p.type==0 || p.type==2" class="weui_cell_bd weui_cell_primary">
							{{p.data}}
						</div>
						<div ng-if="p.type==1 || p.type==3 || p.type==4" class="weui_cell_bd weui_cell_primary">
							<img style="max-width:100%" ng-src="{{tomedia(p.data) ||'../core/resource/images/nopic.jpg'}}"/>
						</div>
					</div>
				</div>
				<div class="weui_cell weui_vcode">
					<div class="weui_cell_hd"><label class="weui_label">添加步骤</label></div>
					<div class="weui_cell_bd weui_cell_primary">
					</div>
					<div ng-click="pagedata.showadd_steps=true;" class="weui_cell_ft" style="padding-right:0.5rem">
						<i class="icon icon-tianjia"></i>
					</div>
				</div>
				
	</div>
	<div class="weui_btn_area">
			 <a class="weui_btn weui_btn_primary" href="javascript:" id="showTooltips" ng-click="post(pagedata.post,'/renwu.myup/post/')">提交</a>
	</div>
</div>
</div>
<div ng-if="pagedata.showadd_steps" class="popup">
	<div class="popup-body">
		<div class="popup-bottom">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showadd_steps=false"></i>
			<div class='fui-content' style="background:#fff;width:auto;padding:0.5rem">
				<div class="weui_cells weui_cells_radio2" style="margin-top:8rpx">
					<div class="title bold" style="padding-bottom:0.5rem">选择步骤类型 / <small>Type</small></div>
						<label ng-repeat="(k,v) in pagedata.steps_type" class="weui_cell weui_check_label dashed">
							<div class="weui_cell_bd weui_cell_primary">
								<span style="float:left;width:100%">{{v}}</span>
							</div>
							<div ng-click="pagedata.add_steps(k);" class="weui_cell_ft">
								<input type="radio" class="weui_check" name="radio1">
								<span class="weui_icon_checked"></span>
							</div>
						</label>
				</div>
			</div>
		</div>
	</div>
</div>
<div ng-if="pagedata.showadd_type" class="popup">
	<div class="popup-body">
		<div class="popup-bottom">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showadd_type=false"></i>
			<div class='fui-content' style="background:#fff;width:auto;padding:0.5rem">
				<div class="weui_cells" style="margin-top:8rpx">
					<div class="title bold" style="padding-bottom:0.5rem">{{pagedata.add_title}} / <small>ADD</small></div>
					<div class="weui_cells_title">步骤说明</div>
					<div class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
							<textarea class="weui_textarea" ng-model="pagedata.addstep.title" placeholder="{{pagedata.placeholder1}}" rows="3"></textarea>
						</div>
					</div>
					<div class="weui_cells_title">{{pagedata.data_title}}</div>
					<div ng-if="pagedata.add_type==0 || pagedata.add_type==2" class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
							<textarea class="weui_textarea" ng-model="pagedata.addstep.data" placeholder="{{pagedata.placeholder}}" rows="2"></textarea>
						</div>
					</div>
					<div ng-if="pagedata.add_type==1 || pagedata.add_type==3 || pagedata.add_type==4" class="weui_cell">
						<div class="weui_cell_bd weui_cell_primary">
							<ul class="weui_uploader_files" ng-if="pagedata.addstep.data">
								<li class="weui_uploader_file" style="background-image:url({{tomedia(pagedata.addstep.data)}})"></li>
							</ul>
							<div class="weui_uploader_input_wrp">
								<input class="weui_uploader_input" ng-model="pagedata.addstep.data" ng-click="up_file(pagedata.addstep,'data','image')" accept="image/jpg,image/jpeg,image/png,image/gif" multiple="">
							</div>
						</div>
					</div>
				</div>
				<div class="weui_btn_area">
					<a class="weui_btn weui_btn_primary" style="background:#00c568;" ng-click="pagedata.up_steps()">提交</a>
				</div>
			</div>
		</div>
	</div>
</div>
<div ng-include="sys_html('_footer')"></div>
<script>
//提交
scope.pagedata.add_steps=function(type){
	scope.pagedata.addstep={'type':type};
	scope.pagedata.add_type=type;
	if(type==0){
		scope.pagedata.add_title='输入网址';
		scope.pagedata.placeholder1='适用于需要输入网址，输入内容，详细说明如何操作！';
		scope.pagedata.data_title='输入网址';
		scope.pagedata.placeholder='网址链接，例如：http://www.baidu.com';
	}else if(type==1){
		scope.pagedata.add_title='上传二维码';
		scope.pagedata.placeholder1='适用于需要上传二维码，输入内容，详细说明如何操作！';
		scope.pagedata.data_title='二维码';
		scope.pagedata.placeholder='';
	}else if(type==2){
		scope.pagedata.add_title='复制数据';
		scope.pagedata.placeholder1='适用于需要复制数据，如填写邀请码，输入内容，提升会员复制数据，方便填写';
		scope.pagedata.data_title='填写数据';
		scope.pagedata.placeholder='如邀请码，钱包地址之类';
	}else if(type==3){
		scope.pagedata.add_title='上传说明图';
		scope.pagedata.placeholder1='适用于需要图文说明，输入内容，详细说明如何操作！';
		scope.pagedata.data_title='说明图';
		scope.pagedata.placeholder='';
	}else if(type==4){
		scope.pagedata.add_title='上传验证图';
		scope.pagedata.placeholder1='适用于需要验证图，输入内容，详细说明如何操作！';
		scope.pagedata.data_title='验证码';
		scope.pagedata.placeholder='';
	}else if(type==5){
		scope.pagedata.add_title='收集信息';
		scope.pagedata.placeholder1='适用于需要收集信息，手机，用户名，姓名，ID等。输入内容，详细说明如何操作！';
	}
	scope.pagedata.showadd_steps=false;
	scope.pagedata.showadd_type=true;
}
scope.pagedata.up_steps=function(){
	if(!scope.pagedata.addstep.title || (!scope.pagedata.addstep.data && scope.pagedata.add_type!=5)){
		scope.message('请完善信息！','error');
		return false;
	}
	scope.pagedata.post.steps.push(angular.copy(scope.pagedata.addstep));
	scope.pagedata.showadd_type=false;
	scope.$evalAsync();
}
scope.pagedata.upyufee=function(){
	if(!scope.pagedata.post.fee || !scope.pagedata.post.totalnum){
		return false;
	}
	scope.pagedata.post.yufee=scope.price(scope.pagedata.post.fee*scope.pagedata.post.totalnum);
	scope.$evalAsync();
}
</script>